package com.example.maili.woxiamg.adapter.moreadapter;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.maili.woxiamg.R;
import com.example.maili.woxiamg.bean.MoreNewBean;
import com.example.maili.woxiamg.utils.AppUtils;

import java.util.List;

/**
 * Created by MAILI on 2017/10/16.
 */

public class MoreNewAdapter extends BaseQuickAdapter<MoreNewBean.ListBean, BaseViewHolder> {
    private Context context;

    public MoreNewAdapter(@LayoutRes int layoutResId, @Nullable List<MoreNewBean.ListBean> data, Context context) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, MoreNewBean.ListBean item) {
        helper.setText(R.id.tv_newTitle, item.getTitle());
        helper.setText(R.id.tv_source, item.getNewsResource());
        helper.setText(R.id.tv_more_new_time, item.getCreateDate());
        AppUtils.displayImageGlide(context, (ImageView) helper.getView(R.id.img_news), item.getImage());
    }
}
